/*
Color class for simple Graph-library, based on SDL.
Writed by SochiX(sochix.blogspot.com)
2010
*/

#ifndef COLOR_H
#define COLOR_H

#include "SDL.h"
class Color
{
	private:
	double red;
	double green;
	double blue;	
	public:
	Color() {SetRed(0.0); SetGreen(0.0); SetBlue(0.0);};
	Color(double newRed,double newGreen,double newBlue) {SetRed(newRed);SetGreen(newGreen);SetBlue(newBlue);};
	Color(const Color& C) {SetRed(C.red);SetGreen(C.green);SetBlue(C.blue);}
	double GetRed() {return red;};
	double GetGreen(){return green;};
	double GetBlue() {return blue;};
	void SetRed(double newRed) {red=newRed;};
	void SetGreen(double newGreen) {green=newGreen;};
	void SetBlue(double newBlue) {blue=newBlue;};
	Color& operator+= (const Color& v) {red+=v.red; green+=v.green; blue+=v.blue; return *this;}	
	Color& operator*= (const Color& v) {red*=v.red; green*=v.green; blue*=v.blue; return *this;}
	Color& operator*= (double v) {red*=v; green*=v; blue*=v; return *this;}
	
	friend Color operator+(Color&, Color&);
	friend Color operator*(Color&, Color&);
	friend Color operator*(double, Color&);
	friend Color operator*(Color&, double);
 
	/*
	friend Color operator+(const Color&, const Color&);
	friend Color operator*(const Color&, const Color&);
	friend Color operator*(float, const Color&);
	friend Color operator*(const Color&, float);
	*/
};	

inline Color operator+(Color& u, Color& v) {return Color(u.GetRed()+v.GetRed(),u.GetGreen()+v.GetGreen(),u.GetBlue()+v.GetBlue());}
inline Color operator*(Color& u, Color& v) {return Color(u.GetRed()*v.GetRed(),u.GetGreen()*v.GetGreen(),u.GetBlue()*v.GetBlue());}
inline Color operator*(double a, Color& v) {return Color(v.GetRed()*a,v.GetGreen()*a,v.GetBlue()*a);}
inline Color operator*(Color& v,double a) {return Color(v.GetRed()*a,v.GetGreen()*a,v.GetBlue()*a);}

#endif //COLOR_H//
